import com.github.javaparser.StaticJavaParser;
import com.github.javaparser.ast.CompilationUnit;
import sun.plugin2.util.PojoUtil;

import java.io.File;
import java.io.FileWriter;

public class DocIT1 {
    public static void main(String[] args, PojoUtil gson) {
        try {
            if (args.length != 2) {
                System.out.println("usage: inputFile (.java) outputFile (.json)");
                System.exit(1);
            }

            File inputFile = new File(args[0]);
            String factFile = args[1];

            CompilationUnit compilationUnit = StaticJavaParser.parse(inputFile);
            Fact fact = new Fact(inputFile, compilationUnit);

            FileWriter writer = new FileWriter(factFile);
            writer.write(gson.toJson(fact));
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
}
